Exception Handlers as Extensible Cases

نویسندگان

  • Matthias Blume
  • Umut A. Acar
  • Wonseok Chae
چکیده

Exceptions are an indispensable part of modern programming languages. They are, however, handled poorly, especially by higherorder languages such as Standard ML and Haskell: in both languages a well-typed program can unexpectedly fail due to an uncaught exception. In this paper, we propose a technique for type-safe exception handling. Our approach relies on representing exceptions as sums and assigning exception handlers polymorphic, extensible row types. Based on this representation, we describe an implicitly typed external language EL where well-typed programs do not raise any unhandled exceptions. EL relies on sums, extensible records, and polymorphism to represent exceptionhandling, and its type system is no more complicated than that for existing languages with polymorphic extensible records. EL is translated into an internal language IL that is a variant of System F extended with extensible records. The translation performs a CPS transformation to represent exception handlers as continuations. It also relies on duality to transform sums into records. (The details for this translation are given in an accompanying technical report.) We describe the implementation of a compiler for a concrete language based on EL. The compiler performs full type inference and translates EL-style source code to machine code. Type inference relieves the programmer from having to provide explicit exception annotations. We believe that this is the first practical proposal for integrating exceptions into the type system of a higher-order language.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

On Inter-Application Reuse of Exception Handling Aspects

In this paper we describe a study whose goal is to answer the question: “Is exception handling a reusable aspect”? To this end, we have systematically attempted to reuse exception handling AspectJ aspects across seven different real applications, some of them from the same domain, some based on the same development platform. Our preliminary results indicate that, due to a number of reasons, int...

متن کامل

Algebraic effects for Functional Programming

Algebraic effect handlers, are recently gaining in popularity as a purely functional approach to modeling effects. In this article, we give an end-to-end overview of practical algebraic effects in the context of a compiled implementation in the Koka language. In particular, we show how algebraic effects generalize over common constructs like exception handling, state, iterators and async-await....

متن کامل

A Fully Object-Oriented Exception Handling System: Rationale and Smalltalk Implementation

This paper motivates and presents the specification and the implementation of an exception handling system for an dynamically typed object-oriented language. A full object-oriented representation of exceptions and handlers, a meta-object protocol to handle using either termination or resumption makes the system powerful as well as extendible and solves various exception handling issues. Three k...

متن کامل

Handlers of Algebraic Effects

We present an algebraic treatment of exception handlers and, more generally, introduce handlers for other computational effects representable by an algebraic theory. These include nondeterminism, interactive input/output, concurrency, state, time, and their combinations; in all cases the computation monad is the free-model monad of the theory. Each such handler corresponds to a model of the the...

متن کامل

On Scheduling Exception Handlers in Dynamic Real-Time Systems

We consider the problem of scheduling exception handlers in real-time systems that operate under runtime uncertainties including those on execution times, activity arrivals, and failure occurrences. The application/scheduling model includes activities and their exception handlers that are subject to time/utility function (TUF) time constraints and an utility accrual (UA) optimality criterion. A...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2008